#!/bin/bash

IP=$(cat {{ env_dir }}/etcd.sh | awk -F= '{print $2}')

echo $IP | grep "{{ master_ip }}" > /dev/null

if [ "$?" -ne 0 ];then
    curl http://{{ master_ip }}:{{ etcd_port_c1 }}/v2/members -XPOST -H "Content-Type: application/json" -d '{"peerURLs": ["http://'$IP':{{ etcd_port_s1 }}"]}'
else
    echo "master node {{ master_ip }}"
fi